package com.imay.live.utils;

import android.content.Context;
import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.imay.live.R;
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;

/**
 * Created by  nick on 2017/4/18 0018.
 */

public class RecyclerViewUtil {

    public static void setLinearLayoutManager(Context context, RecyclerView recyclerView) {
        recyclerView.setNestedScrollingEnabled(false);
        LinearLayoutManager layoutManager = new LinearLayoutManager(context);
        layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
        recyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(context).colorResId(R.color.bg_f5)
                .sizeResId(R.dimen.divider_size_1x)
                .build());
        recyclerView.setLayoutManager(layoutManager);
    }

    public static void setLinearLayoutManagerWithoutDivider(Context context, RecyclerView recyclerView) {
        LinearLayoutManager layoutManager = new LinearLayoutManager(context);
        recyclerView.setLayoutManager(layoutManager);
    }

    public static void setLinearLayoutManagerHorizontal(Context context, RecyclerView recyclerView){
        recyclerView.setNestedScrollingEnabled(false);
        LinearLayoutManager labelsLayoutManager = new LinearLayoutManager(context);
        labelsLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        recyclerView.setLayoutManager(labelsLayoutManager);
    }
}
